<template>
  <div class="feedback-container">
    <div class="header">
      <div class="back-btn" @click="goBack">←</div>
      <div class="header-text">意见反馈</div>
    </div>
    <div class="content">
      <p>为了给您带来更好的使用体验，我们非常重视您的反馈并及时跟进</p>
      <div class="form-item">
        <label for="feedbackContent">反馈内容：</label>
        <textarea id="feedbackContent" v-model="feedbackContent" placeholder="请输入反馈内容"></textarea>
      </div>
      <div class="form-item">
        <label for="phoneNumber">手机号（选填）：</label>
        <input type="text" id="phoneNumber" v-model="phoneNumber" placeholder="请输入手机号">
      </div>
      <div class="submit-btn" @click="submitFeedback">提交反馈</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      feedbackContent: '',
      phoneNumber: '',
    };
  },
  methods: {
    goBack() {
      // 这里可以添加返回上一页的逻辑，例如使用Vue Router的$router.back()方法
      this.$router.back();
    },
    submitFeedback() {
      // 这里可以添加提交反馈的逻辑，例如发送请求到后端API
      if (this.feedbackContent.trim() === '') {
        alert('请输入反馈内容');
        return;
      }
      // 假设这里有一个名为submitFeedback的方法用于发送反馈数据到后端
      this.submitFeedbackToBackend();
    },
    submitFeedbackToBackend() {
      // 模拟发送反馈数据到后端的请求
      console.log('反馈内容：', this.feedbackContent);
      console.log('手机号：', this.phoneNumber);
      alert('反馈已提交，感谢您的支持！');
      this.feedbackContent = '';
      this.phoneNumber = '';
    }
  }
}
</script>

<style scoped>
.feedback-container {
  background-color: white;
  min-height: 100vh;
  padding: 10px;
}

.header {
  display: flex;
  align-items: center;
  background-image: linear-gradient(to right, #FF69B4, #00FFFF);
  padding: 10px;
}

.back-btn {
  font-size: 20px;
  color: white;
  margin-right: 10px;
}

.header-text {
  font-size: 20px;
  font-weight: bold;
  color: white;
  flex: 1;
  text-align: center;
}

.content {
  margin-top: 20px;
}

p {
  margin-bottom: 10px;
}

.form-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 15px;
}

label {
  font-size: 16px;
  margin-bottom: 5px;
}

textarea,
input {
  border: 1px solid #E0E0E0;
  border-radius: 5px;
  padding: 10px;
}

.submit-btn {
  background-color: #007AFF;
  color: white;
  text-align: center;
  padding: 10px;
  border-radius: 5px;
  cursor: pointer;
}
</style>
